//引入express模块
const express = require("express")
//引入路由模块
const router = require("./router/router.js")

const cors = require("cors");

//创建app实例
const app = express()
//创建req.body
app.use(express.json({limit:"50mb"}))
app.use(express.urlencoded({limit:"50mb"}))
app.use(cors()); //使用cors中间件

//使用路由模块
app.use("/api", router)
//响应app
app.listen(9000, () => {
    console.log("服务器已启动");
})